Infinispan data sources use a Teiid specific JCA connector "teiid-connector-infinispan.rar", which is deployed into the AS7.x during installation. This connector can be configured to support the following modes of Infinispan caches:
Cache Type
|
Obtain Cache By
|
Local Cache
|
using JNDI
|
Local Cache
|
using configuration file
|
Remote Cache
|
using JNDI
|
Remote Cache
|
specify 1 or more host:port's
|
Remote Cache
|
specify HotRod client properties file
|
The following are the configuration properties that can be configured for this connector:
Property Name
|
Req.
|
Property Template
|
Description
|
CacheTypeMap
|
Y
|
cacheName:className[;pkFieldName] [,cacheName:className[;pkFieldName]..]
|
Map the root Java Object class name to the cache, and identify which attribute is the primary key to the cache.
|
module
|
N
|
|
Specify the JBoss AS module that contains the cache classes that were defined in CacheTypeMap
|
CacheJndiName
|
N
|
|
JNDI name to fine the CacheContainer
|
RemoteServerList
|
N
|
host:port[;host:port….]
|
Specify the host and ports that will be clustered together to access the caches defined in CacheTypeMap
|
ConfigurationFileNameForLocalCache
|
N
|
|
The Infinispan Configuration xml file for configuring a local cache
|
HotRodClientPropertiesFile
|
N
|
|
The HotRod properties file for configuring a connection to a remote cache
|
There are many ways to create the data source, using CLI,
AdminShell
, admin-console etc. The example shown below uses the CLI tool, as this works in both Standalone and Domain modes.
Execute following command using CLI
once you connected to the Server. Make sure you provide the correct directory name and other properties below. Add any additional properties required by the connector by duplicating the "connection-definitions" command below. Edit the JNDI name to match the JNDI name you used in VDB.
batch
/subsystem=resource-adapters/resource-adapter=infinispanDS:add(archive=teiid-connector-infinispan.rar, transaction-support=NoTransaction){color}
/subsystem=resource-adapters/resource-adapter=infinispanDS/connection-definitions=infinispanDS:add(jndi-name=java:/infinispanDS, class-name=org.teiid.resource.adapter.infinispan.InfinispanManagedConnectionFactory, enabled=true, use-java-context=true){color}
/subsystem=resource-adapters/resource-adapter=infinispanDS/connection-definitions=infinispanDS/config-properties=CacheTypeMap:add(value=trades:org.somewhere.Trade;tradeId){color}
/subsystem=resource-adapters/resource-adapter=infinispanDS/connection-definitions=infinispanDS/config-properties=Module:add(value=org.somewhere)
/subsystem=resource-adapters/resource-adapter=infinispanDS/connection-definitions=infinispanDS/config-properties=CacheJndiName:add(value=java:/myCache)
runbatch
To find out all the properties that are supported by this File Connector execute the following command in the CLI.
/subsystem=teiid:read-rar-description(rar-name=teiid-connector-infinispan.rar)
As of AS 7.1 CR1b release the above does not work without restarting the Server. This issue will be fixed before 7.2 Final.
Developer's Tip
If the JBoss AS 7.x is running in standalone mode, you can also manually edit the "<jboss-install>/standalone/configuration/standalone-teiid.xml" file and add the XML configuration defined in "<jboss-install>/docs/teiid/datasources/infinispan" directory under "resource-adapters" subsystem. Shutdown the server before you edit this file, and restart after the modifications are done.